(function () {
    document.getElementById("form").onsubmit = function (event) {
        var name = document.getElementById("form-name").value;
        var pass = document.getElementById("form-pass").value;
        var gender = document.getElementById("form-gender-male").checked ? "男" : "女";
        var education =
            Array.from(document
                .getElementById("form-education")
                .getElementsByTagName("option"))
            .find(option => option.selected)
            .text;
        var description = document.getElementById("form-description").value;

        if (name !== "admin") {
            alert("用户名必须为 admin！");
            return false;
        }

        alert("用户名：" + name +
            "\n密码：" + pass +
            "\n性别：" + gender +
            "\n学历：" + education +
            "\n自我介绍：" + description);
        return true;
    };
})();
